home *** CD-ROM | disk | FTP | other *** search
/ Graphics Plus / Graphics Plus.iso / amiga / gui / mui / mui14-dv.lha / MUI / Developer / C / Examples / demo.h < prev    next >
Encoding:
C/C++ Source or Header  |  1993-10-28  |  2.4 KB  |  136 lines

  1. /*************************************************************/
  2. /* Includes and other common stuff for the MUI demo programs */
  3. /*************************************************************/
  4.  
  5. /* MUI */
  6. #include <libraries/mui.h>
  7.  
  8. /* System */
  9. #include <dos/dos.h>
  10. #include <graphics/gfxmacros.h>
  11. #include <workbench/workbench.h>
  12.  
  13. /* Prototypes */
  14. #include <clib/alib_protos.h>
  15. #include <clib/exec_protos.h>
  16. #include <clib/dos_protos.h>
  17. #include <clib/icon_protos.h>
  18. #include <clib/graphics_protos.h>
  19. #include <clib/intuition_protos.h>
  20. #include <clib/gadtools_protos.h>
  21. #include <clib/muimaster_protos.h>
  22. #include <clib/asl_protos.h>
  23.  
  24. /* ANSI C */
  25. #include <stdlib.h>
  26. #include <string.h>
  27. #include <stdio.h>
  28.  
  29.  
  30. /* Compiler specific stuff */
  31.  
  32. #ifdef _DCC
  33.  
  34. #define REG(x) __ ## x
  35. #define ASM
  36. #define SAVEDS __geta4
  37.  
  38. #else
  39.  
  40. #define REG(x) register __ ## x
  41.  
  42. #ifdef __MAXON__
  43. #define ASM
  44. #define SAVEDS
  45. #else
  46. #define ASM    __asm
  47. #define SAVEDS __saveds
  48. #endif
  49.  
  50. #include <pragmas/exec_pragmas.h>
  51. #include <pragmas/dos_pragmas.h>
  52. #include <pragmas/icon_pragmas.h>
  53. #include <pragmas/graphics_pragmas.h>
  54. #include <pragmas/intuition_pragmas.h>
  55. #include <pragmas/gadtools_pragmas.h>
  56. #include <pragmas/muimaster_pragmas.h>
  57. #include <pragmas/asl_pragmas.h>
  58.  
  59. extern struct Library *SysBase,*IntuitionBase,*UtilityBase,*GfxBase,*DOSBase,*IconBase;
  60. struct Library *MUIMasterBase;
  61.  
  62. #endif
  63.  
  64.  
  65. /*************************/
  66. /* Init & Fail Functions */
  67. /*************************/
  68.  
  69. static VOID fail(APTR app,char *str)
  70. {
  71.     if (app)
  72.         MUI_DisposeObject(app);
  73.  
  74. #ifndef _DCC
  75.     if (MUIMasterBase)
  76.         CloseLibrary(MUIMasterBase);
  77. #endif
  78.  
  79.     if (str)
  80.     {
  81.         puts(str);
  82.         exit(20);
  83.     }
  84.     exit(0);
  85. }
  86.  
  87.  
  88. #ifdef _DCC
  89.  
  90. int brkfunc(void) { return(0); }
  91.  
  92. int wbmain(struct WBStartup *wb_startup)
  93. {
  94.     extern int main(int argc, char *argv[]);
  95.     return (main(0, NULL));
  96. }
  97.  
  98. #endif
  99.  
  100.  
  101. #ifdef __SASC
  102. int CXBRK(void) { return(0); }
  103. int _CXBRK(void) { return(0); }
  104. void chkabort(void) {}
  105. #endif
  106.  
  107.  
  108. static VOID init(VOID)
  109. {
  110. #ifdef _DCC
  111.     onbreak(brkfunc);
  112. #endif
  113.  
  114. #ifndef _DCC
  115.     if (!(MUIMasterBase = OpenLibrary(MUIMASTER_NAME,MUIMASTER_VMIN)))
  116.         fail(NULL,"Failed to open "MUIMASTER_NAME".");
  117. #endif
  118. }
  119.  
  120.  
  121. #ifndef __SASC
  122. static VOID stccpy(char *dest,char *source,int len)
  123. {
  124.     strncpy(dest,source,len);
  125.     dest[len-1]='\0';
  126. }
  127. #endif
  128.  
  129.  
  130. #ifndef MAKE_ID
  131. #define MAKE_ID(a,b,c,d) ((ULONG) (a)<<24 | (ULONG) (b)<<16 | (ULONG) (c)<<8 | (ULONG) (d))
  132. #endif
  133.  
  134.  
  135. LONG __stack = 8192;
  136.